#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpSocket>
#include <QSerialPort>
#include <QThread>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void newConnect();
    void tcpSocket1RecServer();
    void UartPortToVirRecServer();
    void UartPortToRegRecServer();

    void on_btnScan_clicked();
    void on_btnOpen_clicked();

    void on_btnConnect_clicked();

    void on_btn_copy2_clicked();
    void on_btn_copy4_clicked();
    void on_btn_copy5_clicked();


    void on_btn_setug_clicked();

    void on_btn_setstart_clicked();

    void on_btn_setstop_clicked();

    void on_btn_setig_clicked();

    void on_btnScan_toReg_clicked();

    void on_btnOpen_toReg_clicked();

private:
    Ui::MainWindow *ui;
    QTextCodec *codec;

    QTcpSocket * tcpSock1;
    QSerialPort *m_serialPortToVirtual, *m_serialPortToReg;
    QByteArray MainSerialRecvData, tcpSock1RecvData;

    QByteArray m_nowTcpRecData;

    uint16_t m_tcpRecCounter, m_uartRecCounter;

    void excTcpDateAnalyze(QByteArray i_date);
    void excUartDateAnalyze(QByteArray i_date);
};

#endif // MAINWINDOW_H
